﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AssessmentTool.Services.DTO;
using AssessmentTool.PresentationLogic;
using ModelLayer;
using System.ComponentModel;
using AssessmentTool.Services;

namespace AssessmentTool.ServiceBridge
{
    public class UtenteServiceBridge
    {

        public static UtenteServiceClient getProxy()
        {
            var proxy = new UtenteServiceClient();
            proxy.Endpoint.Address = DynamicEndpointHelper.ResolveEndpointUrl("UtenteService");
            return proxy;
        }
        

        public static void login(String username, String password,EventHandler<loginCompletedEventArgs> handler)
        {
            var proxy = getProxy();
            proxy.loginCompleted += new EventHandler<loginCompletedEventArgs>(handler);
            DTOUtente dto = new DTOUtente();
            dto.Username = username;
            dto.Password = password;
            proxy.loginAsync(dto);
        }

        public static void saveChanges(Utente u, EventHandler<saveChangesCompletedEventArgs> handler)
        {
            var proxy = getProxy();
            proxy.saveChangesCompleted += new EventHandler<saveChangesCompletedEventArgs>(handler);
            proxy.saveChangesAsync(u);
        }


        public static void storicizza(Sessione sessione, EventHandler<storicizzaCompletedEventArgs> handler)
        {
            var proxy = getProxy();
            proxy.storicizzaCompleted+=new EventHandler<storicizzaCompletedEventArgs>(handler);
            proxy.storicizzaAsync(sessione);
         
        }

        public static void getProfiliInfo(Utente u,EventHandler<getProfiliInfoCompletedEventArgs> handler)
        {
            var proxy = getProxy();
            proxy.getProfiliInfoCompleted += new EventHandler<getProfiliInfoCompletedEventArgs>(handler);
            proxy.getProfiliInfoAsync(u);
        }

       

    }
}
